<!DOCTYPE html>
<html lang="zh">
{include file="public/head"}
<link rel="stylesheet" type="text/css" href="/static/admin/js/webuploader/webuploader.css">
<body>
<div class="container-fluid">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <div class="card-body">
          
          <form class="row" id="common_form" action="{$action}" method="post">
            <div class="mb-3 col-md-12">
              <label for="username" class="form-label">请输入标签名称</label>
              <input type="text" class="form-control" id="name" name="name" value="{$info.name}" placeholder="请输入标签名称" />
            </div>
            <div class="mb-3 col-md-12">
              <label for="type" class="form-label">所属上级</label>
              <div class="form-controls">
                <select name="pid" class="form-select" id="pid">
                    <option value="0" {if $info.pid == 0}selected="selected"{/if}>作为一级标签</option>
                    {volist name="list" id="v1"}
                    <option value="{$v1.id}" {if $info.pid == $v1.id}selected="selected"{/if}>{$v1.name}</option>
                    {/volist}
                </select>
              </div>
            </div>
            <div class="mb-3 col-md-12">
              <label for="sort" class="form-label">显示排序</label>
              <input type="text" class="form-control" id="sort" name="sort" value="{$info.sort}" placeholder="请输入显示排序"  />
            </div>
            <div class="mb-3 col-md-12">
              <label for="is_recommend" class="form-label">是否推荐:</label>
              <div class="clearfix">
                <div class="form-check form-check-inline">
                  <input type="radio" id="is_recommend" name="is_recommend" class="form-check-input" value="1" {if $info.is_recommend == 1}checked{/if}>
                  <label class="form-check-label" for="is_recommend">推荐</label>
                </div>
                <div class="form-check form-check-inline">
                  <input type="radio" id="is_recommend" name="is_recommend" class="form-check-input" value="0" {if $info.is_recommend == 0}checked{/if}>
                  <label class="form-check-label" for="is_recommend">不推荐</label>
                </div>
              </div>
            </div>
            <div class="mb-3 col-md-12">
              <label for="status" class="form-label">状态</label>
              <div class="clearfix">
                <div class="form-check form-check-inline">
                  <input type="radio" id="status" name="status" class="form-check-input" value="1" {if $info.status == 1}checked{/if}>
                  <label class="form-check-label" for="status">启用</label>
                </div>
                <div class="form-check form-check-inline">
                  <input type="radio" id="status" name="status" class="form-check-input" value="0" {if $info.status == 0}checked{/if}>
                  <label class="form-check-label" for="status">禁用</label>
                </div>
              </div>
            </div>
            <input type="hidden" name="id" value="{$info.id}">
            <input type="hidden" id="jump_url" value="{$action}">
            <div class="mb-3 col-md-12">
              <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">确 定</button>
              <button type="button" class="btn btn-default" id="close_layer_open">返 回</button>
            </div>
          </form>
          
        </div>
      </div>
    </div>
        
  </div>
  
</div>
{include file="public/script"}

<script type="text/javascript" src="/static/admin/js/webuploader/webuploader.js"></script>
<script type="text/javascript">
uploader = WebUploader.create({
    auto: true,
    server: '/admin/common/uploadImage',
    pick: {
        id:'.filePicker',
        //是否开启多个文件选择能力
        multiple:false,
    },
    formData: {
         _token:''
    },
    fileVal:'file',
})
//上传成功时的回调方法
uploader.on('uploadSuccess',function (file,res) {
    if(res.code == 200)
    {
        $('.file_path_value').val(res.data);
        $('.show_upload_file').attr('src', res.data);
    }else{
        showNotify(res.msg, 'danger', 1000, 'mdi mdi-information-outline', 'top', 'right');
    }
})
uploader.on( 'uploadError', function( file ) {
    showNotify('上传文件失败', 'danger', 1000, 'mdi mdi-information-outline', 'top', 'right');
});
</script>
</body>
</html>